﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Diploma.Models;

namespace DiplomaWeb.Models.CompaniesAndLecturers
{
    public class LecturerPracticeListViewModel
    {
        public IEnumerable<LecturerPracticeViewModel> Lecturers { get; set; }

        public IEnumerable<SelectListItem> SelectListLecturers
        {
            get
            {
                return DataManager
                    .Instance
                    .LecturersRepository
                    .GetAllLecturers()
                    .Select(r => new SelectListItem
                        {
                            Value = r.UserId.ToString(),
                            Text = r.FullName
                        });
            }
        }

        public void ToViewModel(IEnumerable<Lecturer> list)
        {
            Lecturers = list.Select(r => new LecturerPracticeViewModel
                                             {
                                                 Id = r.UserId,
                                                 FIO = r.FullName
                                             });
        }
    }
}